﻿namespace WorldMapBase.Tile
{
    /// <summary>
    /// 地块显示元素
    /// </summary>
    public class TileDisplayElement// : IClass, ILegacyDisplayElement
    {
        ///// <summary>
        ///// 地块元素数据
        ///// </summary>
        //private WorldMapNew.TileElement m_Data;

        ///// <summary>
        ///// 实例化对像
        ///// </summary>
        //private WorldObject m_WorldObject;

        //private Transform ObjTrans;

        ///// <summary>
        ///// 创建标记
        ///// </summary>
        //private bool m_createFlag;

        ///// <summary>
        ///// 销毁标记
        ///// </summary>
        //private bool m_destroyFlag;

        ///// <summary>
        ///// 销毁标记
        ///// </summary>
        //public bool DestroyFlag
        //{
        //    get
        //    {
        //        return m_destroyFlag;
        //    }
        //    set
        //    {
        //        m_destroyFlag = value;
        //    }
        //}

        ///// <summary>
        ///// 创建标记
        ///// </summary>
        //public bool CreateFlag
        //{
        //    get
        //    {
        //        return m_createFlag;
        //    }
        //    set
        //    {
        //        m_createFlag = value;
        //    }
        //}

        //public int ResId
        //{
        //    get
        //    {
        //        return m_Data.resID;
        //    }
        //}

        ///// <summary>
        ///// 创建地块物件逻辑对像
        ///// </summary>
        ///// <param name="tile">物件数据</param>
        ///// <returns></returns>
        //public static TileDisplayElement Create(WorldMapNew.TileElement tile)
        //{
        //    TileDisplayElement tileElement = ClassManager.Get<TileDisplayElement>();

        //    tileElement.Initialize(tile);
        //    return tileElement;
        //}

        ///// <summary>
        ///// 初始化
        ///// </summary>
        ///// <param name="tileElementData">物件数据</param>
        //public void Initialize(WorldMapNew.TileElement tileElementData)
        //{
        //    m_Data = tileElementData;
        //    m_createFlag = true;
        //    DisplayManager.AddDisplayElement(this);
        //}

        ///// <summary>
        ///// 回收对像事件
        ///// </summary>
        //public void OnReset()
        //{
        //    m_destroyFlag = true;
        //    DisplayManager.RemoveDisplayElement(this);
        //    WorldGObjPool.RecoverItem(m_WorldObject);
        //    m_Data = null;
        //    m_WorldObject = null;
        //}

        ///// <summary>
        ///// 设置物件位置
        ///// </summary>
        ///// <param name="position"></param>
        //public void SetPosition(Vector3 position)
        //{
        //    ObjTrans.localScale = position;
        //}

        ///// <summary>
        ///// 设置物件缩放
        ///// </summary>
        ///// <param name="scale"></param>
        //public void SetScale(float scale)
        //{
        //    ObjTrans.localScale = new Vector3(scale,scale,1);
        //}

        ///// <summary>
        ///// 设置物件子对像缩放
        ///// </summary>
        ///// <param name="scale"></param>
        //private void SetChildsScale(float scale)
        //{
        //    if (ObjTrans == null)
        //    {
        //        return;
        //    }

        //    for (int i = 0; i < ObjTrans.childCount; i++)
        //    {
        //        Transform tf = ObjTrans.GetChild(i);
        //        tf.localScale = new Vector3(scale, scale, scale);
        //    }
        //}

        //public void Refresh()
        //{
        //    if (m_createFlag)
        //    {
        //        InstanceObj();
        //        m_createFlag = false;
        //    }            
        //}

        ///// <summary>
        ///// 创建实例化对像
        ///// </summary>
        //public void InstanceObj()
        //{
        //    m_WorldObject = WorldGObjPool.GetWorldObject(m_Data.resID);            
        //    m_WorldObject.Initialize(m_Data.resID, m_Data.position,m_Data.scale,m_Data.rotation);
        //}
    }
}